home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / mess / MESS 0.133 / Macintosh / MessMenu 0.7.0 OSX uni.dmg / MessMenu.app / Contents / Resources / runtest < prev    next >
Encoding:
Text File  |  2008-11-18  |  4.5 KB  |  154 lines

  1. #!/bin/sh
  2. # ----------------------------------------------------
  3. # MAME Testing script
  4. # (Windows only at the moment, sorry!)
  5. # Initial setup of the script:
  6. #
  7. #    1. Create a fresh directory mametest/
  8. #    2. Copy this script into it (mametest/runtest.cmd)
  9. #    3. Copy a mame.ini with your ROM paths into it
  10. #        (mametest/mame.ini)
  11. #    4. Copy a transparent crosshair cursor into it
  12. #        (mametest/cross.png)
  13. #
  14. # How to run a test:
  15. #
  16. #    1. Create a new subdirectory mametest/version/
  17. #    2. Copy mame.exe into it (mametest/version/mame.exe)
  18. #    3. Open a command prompt to mametest/version
  19. #    4. Run "..\runtest"
  20. #    5. Wait for all the tests to complete
  21. #
  22. # How to generate a report:
  23. #
  24. #    1. Open a command prompt to mametest.
  25. #    2. Make sure you have run tests for at least two 
  26. #        versions (mametest/ver1 and mametest/ver2)
  27. #    3. Create an output directory (mametest/report)
  28. #    4. Run "regrep report ver1\summary.log ver2\summary.log"
  29. #    5. Upload the report directory to mamedev.org :)
  30. #    6. Differing files are printed to stdout; redirect
  31. #        to create a list that can be run again via
  32. #        this script
  33. # ----------------------------------------------------
  34.  
  35. MAMEEXE=./sdlmame
  36.  
  37. # ----------------------------------------------------
  38. # We require mame.exe to be present
  39. # ----------------------------------------------------
  40.  
  41. if [ ! -f $MAMEEXE ]; then
  42.     echo Missing $MAMEEXE
  43.     exit 1
  44. fi
  45.  
  46. # ----------------------------------------------------
  47. # By default we generate our own list; however, a list 
  48. # can be specified by an alternate parameter. If a 
  49. # parameter is given, we leave the existing log and 
  50. # snap directories intact; otherwise, we delete them 
  51. # and start fresh.
  52. # ----------------------------------------------------
  53.  
  54. LIST=gamelist.txt
  55. if [ "$1" = "" ]; then
  56.     echo Generating full list
  57.     $MAMEEXE -ls >$LIST
  58.     echo Deleting old data
  59.     [ -d log ] && rm -rf log
  60.     [ -d snap ] && rm -rf snap
  61.     [ -f summary.log ] && rm -f summary.log
  62. else
  63.     LIST=$1
  64.     @echo Re-testing $1
  65. fi
  66.  
  67. # ----------------------------------------------------
  68. # Always delete all cfg, nvram, and diff files.
  69. # ----------------------------------------------------
  70.  
  71. [ -d cfg ] && rm -rf cfg
  72. [ -d nvram ] && rm -rf nvram
  73. [ -d diff ] && rm -rf diff
  74.  
  75. # ----------------------------------------------------
  76. # Make sure we use transparent crosshairs.
  77. # ----------------------------------------------------
  78.  
  79. [ ! -d artwork ] && mkdir artwork
  80.  
  81. cp ../cross.png artwork/cross0.png
  82. cp ../cross.png artwork/cross1.png
  83. cp ../cross.png artwork/cross2.png
  84. cp ../cross.png artwork/cross3.png
  85.  
  86. # ----------------------------------------------------
  87. # If we don't yet have a summary.log, create a new one.
  88. # ----------------------------------------------------
  89.  
  90. if [ ! -f summary.log ]; then
  91.     $MAMEEXE >summary.log
  92.     echo @@@@@dir=`pwd`>>summary.log
  93. fi
  94.  
  95. # ----------------------------------------------------
  96. # Create the log directory and a starting timestamp.
  97. # ----------------------------------------------------
  98.  
  99. [ ! -d log ] && mkdir log
  100. echo @@@@@start=`date`>>summary.log
  101.  
  102. # ----------------------------------------------------
  103. # runone: Execute a single game for 30 seconds and
  104. # output the results to the summary.log.
  105. # ----------------------------------------------------
  106.  
  107. runone () {
  108.     echo Testing $1 \($2\)...
  109.     echo >>summary.log
  110.     $MAMEEXE $1 -ftr 1800 -nothrottle -inipath .. -w -video none  1>log/$1.txt 2>log/$1.err
  111.     ret=$?
  112.     echo $1 $ret
  113.     if [ $ret -eq 100 ]; then
  114.         echo @@@@@driver=$1: Exception>>summary.log
  115.         cat log/$1.err >>summary.log
  116.      # elif [ $ret -eq 5 ]; then
  117.     # Do nothing -- game does not exist in this build
  118.     elif [ $ret -eq 3 ]; then
  119.         echo @@@@@driver=$1: Fatal error>>summary.log
  120.         cat log/$1.err >>summary.log
  121.     elif [ $ret -eq 2 ]; then
  122.         echo @@@@@driver=$1: Missing files>>summary.log
  123.         cat log/$1.err >>summary.log
  124.     elif [ $ret -eq 1 ]; then
  125.         echo @@@@@driver=$1: Failed validity check>>summary.log
  126.         cat log/$1.err >>summary.log
  127.     elif [ $ret -eq 0 ]; then
  128.         echo @@@@@driver=$1: Success>>summary.log
  129.     else 
  130.         echo @@@@@driver=$1: Unknown error $ret>>summary.log
  131.     fi
  132.     echo @@@@@source=$2>>summary.log
  133. }
  134.  
  135. process () {
  136.     while read i j; do 
  137.         runone $i `basename $j`
  138.     done
  139. }
  140.  
  141. # ----------------------------------------------------
  142. # Iterate over drivers in the log, extracting the 
  143. # source filename as well, and passing both to runone.
  144. # ----------------------------------------------------
  145.  
  146. cat $LIST | process 
  147.  
  148. # ----------------------------------------------------
  149. # Add a final timestamp and we're done.
  150. # ----------------------------------------------------
  151.  
  152. echo @@@@@stop=`date`>>summary.log
  153.